package com.opennews.openplatform.filter;

import lombok.RequiredArgsConstructor;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

/**
 * Example of specific filter which can be applied to individual route config.
 * <p>
 * - id: order-service
 * uri: lb://order-service
 * predicates:
 * - Path=/api/orders/**
 * filters:
 * - name: MyPreFilter
 */
@RequiredArgsConstructor
@Component
public class MyPreFilter extends AbstractGatewayFilterFactory<Object> {
    @Override
    public GatewayFilter apply(Object config) {
        return (exchange, chain) -> chain.filter(exchange);
    }
}